/*************************************************************************
 *
 *  Copyright (C) 2013 Florian Dang <florian.coin@gmail.com>
 *
 *  This file is part of NatusVerse.
 *
 *  NatusVerse is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  NatusVerse is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with NatusVerse.  If not, see <http://www.gnu.org/licenses/>.
 *
 *************************************************************************/

#ifndef INC_GRAPHICS_GEOMETRY_H_
#define INC_GRAPHICS_GEOMETRY_H_

/*!
 * \file        geometry.h
 * \brief       Geometric SDL : circle drawing
 * \author      Florian Dang
 * \date        2013
 *
 */

#include "graphics/graphics.h"

namespace graphics
{
//! Geometry class
/*!
  Abstract class for multiple forms
*/
class Geometry
{
	public:
		typedef color::t_color     t_color;
		typedef Graphics::t_point  t_point;
		typedef Graphics::t_vector t_vector;

		Geometry() {}
		Geometry(Graphics win, t_color color)
			: win_(win), color_(color) {}
		virtual ~Geometry() {} /*!< virtual destructor */

		// pure virtual functions
		virtual void Draw()     = 0;
		virtual void DrawFill() = 0;
		virtual void Erase()    = 0;

	protected:
		Graphics win_;    /*!< graphical window available for every subclasses */
		t_color  color_;  /*!< color available for every subclasses */
};


//! Circle subclass of Geometry
/*!
  This is a circle
*/
class Circle : public Geometry
{
	public:
		Circle(Graphics win, t_point center, int radius, t_color color)
			: Geometry(win, color), center_(center), radius_(radius) {}

		~Circle() {}

		virtual void Draw();
		virtual void DrawFill(t_color color);
		virtual void DrawFill()
		{
			DrawFill(color_);
		}
		virtual void Erase()
		{
			DrawFill(color::black);
		}

	private:
		t_point center_;
		int     radius_;
};

//! Rectangle subclass of Geometry
/*!
  This is a rectangle
*/
class Rectangle : public Geometry
{
	public:
		Rectangle(Graphics win, t_point p1, t_point p2, t_color color)
			: Geometry(win, color), p1_(p1), p2_(p2) {}
//		Rectangle(const Graphics& win, const t_point& p1,const  t_point& p2, const t_color& color)
//			: Geometry(win, color), p1_(p1), p2_(p2) {}

		~Rectangle() {}

		virtual void Draw();
		virtual void DrawFill(t_color color);
		virtual void DrawFill()
		{
			DrawFill(color_);
		}
		virtual void Erase()
		{
			DrawFill(color::black);
		}

	private:
		t_point p1_;
		t_point p2_;
};
} // end namespace graphics

#endif  // INC_GRAPHICS_GEOMETRY_H_
